﻿namespace RialternativeSample.Client.Northwind
{
    using System;
    using System.Collections.ObjectModel;
    using Microsoft.Windows.Data.DomainServices;
    using RialternativeSample.Client.Northwind.Interfaces;
    using RialternativeSample.Server.NorthwindService;

    public class EmployeesDataService : IEmployeesDataService
    {
        private NorthwindContext context;

        public EmployeesDataService(NorthwindContext context)
        {
            this.context = context;
        }

        public void GetEmployeesAsync(Action<ObservableCollection<Employees>> callback)
        {
            this.context.Load(
                this.context.GetEmployeesQuery(),
                lo => callback(new EntityList<Employees>(this.context.Employees, lo.Entities)),
                null);
        }
    }
}
